<template>
  <el-container>
    <!-- 左侧导航栏 -->
    <el-aside width="200px" class="sidebar">
      <el-menu
          :default-active="$route.path"
          class="el-menu-vertical-demo"
          @select="handleSelect"
      >
        <el-menu-item index="/">首页</el-menu-item>
        <el-menu-item index="/restaurant">餐馆信息</el-menu-item>
        <el-menu-item index="/user-profile">个人资料</el-menu-item>
      </el-menu>
    </el-aside>

    <!-- 主体内容 -->
    <el-main>
      <router-view />
    </el-main>
  </el-container>
</template>

<script>
export default {
  methods: {
    handleSelect(index) {
      this.$router.push(index); // 根据选中的菜单项跳转到对应的路由
    }
  }
};
</script>

<style scoped>
.sidebar {
  background-color: #f4f4f4;
  padding: 10px;
}

.el-menu-vertical-demo {
  height: 100%;
  border-right: none;
}

.el-menu-item {
  font-size: 18px;
}
</style>
